//
//  BrokerDataManage.m
//  WGFGlobalHouses
//
//  Created by waiguofang on 15/6/10.
//  Copyright (c) 2015年 waiguofang. All rights reserved.
//

#import "BrokerDataManage.h"
#import "DealerDataManage.h"
#import "StringTool.h"
#import "config.h"



@implementation BrokerDataManage


+(void)backCheckVersion{
    
    [MBProgressHUD showMessage:@"请稍候..."];
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
        
        NSString *itunesURL = [NSString stringWithFormat:@"http://itunes.apple.com/lookup?id=%@",APP_ID];
        ResulteMod *mod = [Connect doGetWithOutCaChe:itunesURL];
        
        dispatch_async(dispatch_get_main_queue(), ^{
            
            
            [MBProgressHUD hideHUD];
            
            
            if (mod.resltState ==ResultNetError) {
                
                [MBProgressHUD showError:@"网络出错"];
                
            }else if(mod.resltState==ResultFail){
                
            
            }else{
            
                int versionCount = [mod.resultDic[@"resultCount"] intValue];
                
                if (versionCount>0) {
                    
                    NSURL * url = [NSURL URLWithString:itunesURL];
                    [[UIApplication sharedApplication] openURL:url];
                }else{
                    [MBProgressHUD showSuccess:@"已经是最新版本"];
                }
            }
        });
    });
}




@end
